#define DEBUG
#include <cstdio>

using namespace std;

const int mods=998244353, maxm=20000000;

long long qpower(long long a, long long n) {
  long long s=1;
  if (n==0) {
    return 1;
  }
  n%=mods-1;
  for (; n; n>>=1) {
    if (n&1) {
      s = s*a%mods;
    }
    a = a*a%mods;
  }
  return s;
}

int findMaxPower(long long p, long long n) {
  int k=0;
  for (long long t=p; n%t==0; k++, t*=p);
  return k;
}

void initF(long long f[], int p, long long n, int m, long long b) {
  static long long power[maxm+1];
  int x=findMaxPower(p, b);

  power[0] = 1;
  long long t=p;
  for (int i=1; t<=m; i++, t=t*p) {
    f[t] = 0;
    power[i] = t%mods;
    if (i<=x) {
      for (int j=0; j<=i; j++) {
	f[t] = (f[t]+power[j]*((qpower(i-j+1, n)-qpower(i-j, n)+mods)%mods)%mods)%mods;
      }
    } else {
      for (int j=0; j<x; j++) {
	f[t] = (f[t]+power[j]*((qpower(i-j+1, n)-qpower(i-j, n)+mods)%mods)%mods)%mods;
      }
      f[t] = (f[t]+(power[x]*qpower(i-x+1, n))%mods)%mods;
    }
  }
}

long long sieve(int m, long long n, long long b) {
  long long ans=1;
  static long long f[maxm+1];
  static bool book[maxm+1];
  static int prime[maxm+1], low[maxm+1];

  f[1] = 1;
  for (int i=2; i<=m; i++) {
    if (!book[i]) {
      initF(f, i, n, m, b);
      prime[++prime[0]] = low[i] = i;
    }
    for (int j=1; j<=prime[0] && i*prime[j]<=m; j++) {
      book[i*prime[j]] = true;
      if (i%prime[j]==0) {
	low[i*prime[j]] = low[i]*prime[j];
	//	if (low[i]!=i) {
	f[i*prime[j]] = f[i/low[i]]*f[low[i]*prime[j]]%mods;
	  //}
	break;
      } else {
	low[i*prime[j]] = prime[j];
	f[i*prime[j]] = f[i]*f[prime[j]]%mods;
      }
    }
    ans = (ans+f[i])%mods;
  }
  return ans;
}

int main() {
  freopen("sequence.in", "r", stdin);
  freopen("sequence.out", "w", stdout);

  long long n, b;
  int m;
  scanf("%lld %d %lld", &n, &m, &b);

  printf("%lld", sieve(m, n, b));

  fclose(stdin);
  fclose(stdout);
  return 0;
}
